package com.example.programming.sys.mapper;

import com.example.programming.sys.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 *  Mapper 接口 chrimer
 * </p>
 *
 * @author chrimer
 * @since 2020-06-25
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {

    @Select("SELECT id FROM user where nickname = #{username}")
    String getid(String username);
    @Select("SELECT useful FROM user where nickname = #{username}")
    int getuseful(String username);
    @Select("SELECT nickname FROM user where id = #{id}")
    String getnickname(String id);
    @Select("SELECT online FROM user where id = #{id}")
    String getonline(String id);
    @Select("SELECT id FROM user where nickname = #{username}")
    String user(String username);
    @Update("UPDATE user SET useful=#{useful} WHERE id=#{id}")
    void updateUseful(String id,Integer useful);
    @Update("UPDATE user SET online=#{online} WHERE id=#{id}")
    void updateOnLine(String id,Integer online);
    @Update("UPDATE user SET password=#{password} WHERE nickname=#{nickname}")
    void updatepassword(String nickname,String password);
}
